<template>
  <div class="recommended-products">
    <div v-if="navigator === 'mobile'" class="h5">
      <h1 class="d-title">Recommended products</h1>
      <p class="sub-title">These are the products you may use</p>
      <div class="products">
        <div v-for="(item, index) in componentData.list" :key="index" class="pro-col">
          <div class="pro-item">
            <img :src="item.coverImage" alt="" />
            <p class="ft-bold">{{ item.titleZh }}</p>
            <p class="ft-24 grey">{{ item.subtitleZh }}</p>
          </div>
        </div>
      </div>
      <div class="more">See more →</div>
    </div>
    <div v-else class="pc">
      <div class="product">
        <p class="ft-30">{{ componentData.titleZh }}</p>
        <p class="ft-18">{{ componentData.subTitleZh }}</p>
        <div class="pro-col">
          <div v-for="(item, index) in componentData.list" :key="index" class="pro-item">
            <img :src="item.coverImage" alt="" />
            <p class="ft-bold">{{ item.titleZh }}</p>
            <p class="ft-16">{{ item.subtitleZh }}</p>
          </div>
        </div>
        <div class="more">See more →</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
    // 设备型号
    navigator: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      list: ['1', '2', '3', '4'],
    }
  },
  computed: {},
  methods: {},
}
</script>

<style lang="less" scoped>
@import '~assets/var';

.recommended-products {
  background-color: #fff;

  .h5 {
    position: relative;
    background-color: #fff;

    .d-title {
      font-size: 18px;
      font-weight: bold;
      color: #333;
      padding: 24px;
      text-align: center;
    }

    .sub-title {
      font-size: 12px;
      font-weight: 500;
      color: #888;
      padding-left: 12px;
    }

    .products {
      width: 100%;
      margin-top: 10px;
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;

      .pro-col {
        margin-left: 12px;

        &:nth-last-child(1) {
          margin-right: 12px;
        }

        .pro-item {
          width: 158px;
          height: 200px;
          background: #f0f0f0;
          display: flex;
          align-items: center;
          flex-direction: column;
          text-align: center;
          padding-top: 8px;
          margin-bottom: 12px;

          img {
            max-width: 120px;
            max-height: 120px;
          }
        }
      }
    }

    .ft-24 {
      font-size: 12px;
    }

    .more {
      color: #0261bc;
      text-align: right;
      font-size: 13px;
      font-weight: bold;
      margin: 12px;
    }
  }

  .pc {
    background-color: #fff;
    border: 1px dashed #e0e4ec;
    position: relative;
    overflow: hidden;
    .width(1200);

    margin: 0 auto;

    .product {
      .pd(0, 0, 30, 0);
      .ft(24);

      &::after {
        content: '';
        clear: both;
        display: block;
      }

      .ft-30 {
        .ft(30);

        color: #333;
        font-weight: bold;
      }

      .ft-18 {
        .ft(18);

        color: #888;
        font-weight: 400;
      }

      .pro-col {
        .mg(40, 0, 0, 0);

        display: flex;

        .pro-item {
          .width(280);
          .height(370);
          .pd(15, 0, 0, 0);
          .mg(0, 0, 24, 0);
          .ft(20);

          &+.pro-item {
            .mg(0, 0, 24, 24);
          }

          background: #f0f0f0;
          display: flex;
          align-items: center;
          flex-direction: column;
          text-align: center;
          overflow: hidden;

          .ft-bold {
            .mg(20, 0, 0, 0);
          }

          img {
            .maxWidth(240);
            .maxHeight(240);

            transition: 0.3s all linear;

            &:hover {
              transform: scale(1.1);
            }
          }

          .ft-16 {
            .ft(16);

            color: #777;
          }
        }
      }

      .more {
        color: #0762cb;
        float: right;
        cursor: pointer;
        .ft(18);
      }
    }
  }
}
</style>
